package org.kisekiproject.evaluator {
	/**
	 * @author mikael
	 */
	public class Token {

		private var _value:Object;
		private var _type:String;
		private var _index:int;

		public static const NUMBER:String="number";
		public static const STRING:String="string";
		public static const SYMBOL:String="symbol";
		public static const BINARY_OPERATOR:String="binaryOperator";
		public static const UNARY_OPERATOR:String="unaryOperator";
		public static const INDIRECTION:String="indirection";
		public static const LEFT_PARENTHESES:String="leftParentheses";
		public static const RIGHT_PARENTHESES:String="rightParentheses";
		public static const FLOW:String="flow";
		public static const FUNCTION_CALL:String="functionCall";
		public static const METHOD_CALL:String="methodCall";

		public var callToken:Token;
		public var argumentCount:int;

		/**
		 * Constructor.
		 */
		public function Token(type:String, value:Object, index:int) {
			_type=type;
			_value=value;
			_index=index;
		}

		/**
		 * Get index of the token in the original stream.
		 */
		public function get index():int {
			return _index;
		}

		/**
		 * Get type.
		 */
		public function get type():String {
			return _type;
		}

		/**
		 * Get value.
		 */
		public function get value():Object {
			return _value;
		}

		/**
		 * Get number.
		 */
		public function get number():Number {
			return _value as Number;
		}

		/**
		 * Get string.
		 */
		public function get string():String {
			return _value as String;
		}

		/**
		 * Get string representation.
		 */
		public function toString():String {
			return "[Token:"+_type+" "+_value+"]";
		}
	}
}
